home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c
- Path: howland.reston.ans.net!torn!sq!msb
- From: msb@sq.com (Mark Brader)
- Subject: Re: Help with C Date/Time Calc
- Message-ID: <1996Mar24.201410.14507@sq.com>
- Organization: SoftQuad Inc., Toronto, Canada
- References: <4irm8d$bev@dfw-ixnews5.ix.netcom.com> <4it4ru$h9c@fohnix.metronet.com>
- Date: Sun, 24 Mar 1996 20:14:10 GMT
-
- Keith Zawila (kzawila@ix.netcom.com) wrote:
- > > I have the total number of seconds that have elapsed since 1/1/70,
- > > and need to calculate the current date/time.
-
- Stan Milam (milam@fohnix.metronet.com) answered:
- > Check your manual for time(), localtime(), strftime(), ctime(), gmtime(),
- > and mktime(). ...
-
- Note that those functions work with an arithmetic type called time_t,
- which represents calendar times (i.e. date and time) in a manner NOT
- specified by the C standard. On UNIX systems, this manner happens to
- be "the total number of seconds that have elapsed since 1/1/70". Keith
- is probably using a UNIX system or he wouldn't have asked that particular
- question; if so, Stan has answered it.
-
- However, if Keith is using some other kind of system that represents dates
- in a different manner, then this sort of problem does become tricky. (Not
- inherently hard; it's a matter of simple arithmetic and doens't need
- explaining here in detail. But it can be tricky to account for all the
- little quirks in our calendar, especially if you've never done it before.)
- --
- Mark Brader "On our campus the UNIX system has proved to be not
- msb@sq.com only an effective software tool, but an agent of
- SoftQuad Inc. technical and social change within the University."
- Toronto -- John Lions, 1979
-
- My text in this article is in the public domain.
-